package com.fenghongzhang.module_home.ui.movie

import androidx.fragment.app.viewModels
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.fenghongzhang.module_home.R
import com.fenghongzhang.module_home.widget.BigImageView
import java.io.IOException
import java.io.InputStream

class MovieFragment : Fragment() {

    companion object {
        fun newInstance() = MovieFragment()
    }

    private val viewModel: MovieViewModel by viewModels()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        // TODO: Use the ViewModel
    }

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        val inflate = inflater.inflate(R.layout.home_fragment_movie, container, false)
        val image = inflate.findViewById<BigImageView>(R.id.big_tu)
        //Glide.with(this).load(R.drawable.big).override(100,100).into(image)
        // 从assets加载大图
        try {
//            val inputStream: InputStream = resources.assets.open("big.jpg")
//            image.setInputStream(inputStream)
        } catch (e: IOException) {
            e.printStackTrace()
        }
        return inflate.rootView
    }
}